package com.chinairi.mall.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chinairi.mall.model.GoodsFeature;
import com.chinairi.mall.dao.GoodsFeatureMapper;
import com.chinairi.mall.model.GoodsInfo;
import com.chinairi.mall.service.IGoodsFeatureService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * <p>
 * 商品特征量 服务实现类
 * </p>
 *
 * @author gsl
 * @since 2020-09-05
 */
@Service
public class GoodsFeatureServiceImpl extends ServiceImpl<GoodsFeatureMapper, GoodsFeature> implements IGoodsFeatureService {
    @Autowired
    private GoodsFeatureMapper goodsFeatureMapper;

    /**
     * 配置商品特征量
     *
     * @param goodsFeature
     */
    @Override
    public void config(GoodsFeature goodsFeature) {
        goodsFeature.setGfDbid(UUID.randomUUID().toString().replace("-", ""));
        goodsFeatureMapper.insert(goodsFeature);
    }

    /**
     * 获取所有特征量
     *
     * @return
     */
    @Override
    public List<GoodsFeature> getList() {
        QueryWrapper<GoodsFeature> queryWrapper = new QueryWrapper<>();
        return goodsFeatureMapper.selectList(queryWrapper);
    }
}
